#include "statusbarwidget.h"
#include "ui_statusbarwidget.h"
//#include "browsermainwindow.h"

StatusBarWidget::StatusBarWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StatusBarWidget)
{
    ui->setupUi(this);
    timer = new QTimer(this);
    connect(timer, &QTimer::timeout, this, [=](){
       hideText();
    });
    timer->start(100);
}

StatusBarWidget::~StatusBarWidget()
{
    delete ui;
}

void StatusBarWidget::showText(QString str)
{
    this->ui->label->setText(str);
    show();
    timer->start(1000);     // 1秒后关闭
}

void StatusBarWidget::hideText()
{
    this->ui->label->setText("");
    hide();
}

void StatusBarWidget::paintEvent(QPaintEvent *event)
{
//    // 移动到右下角
//    BrowserMainWindow *p = qobject_cast<BrowserMainWindow*>(parent());

//    move(0, p->height());
}


